<{include file="admin/head.html"}>
<link rel="stylesheet" href="<{$smarty.const.__URL__}>plugins/ueditor/themes/default/ueditor.css"/>
<script type="text/javascript">
	URL = "<{$smarty.const.__URL__}>plugins/ueditor/";
</script>
<body>
	<{include file="admin/nav.html"}>
	<div id="content">
		<div id="sidebar">
			<ul>
				<li><a href="index.php">后台首页</a></li>
				<li><a href="index.php?do=addIndexList">添加首页显示产品</a></li>
				<li><a href="index.php?do=indexList">首页产品列表</a></li>
				<li><a href="index.php?do=feature">首页精选产品</a></li>
			</ul>
		</div>
		<div id="main">
			<h2 id="page_title"><{$pageTitle}></h2>
			<form action="index.php?" method="post" enctype="multipart/form-data">
				<table class="form_table">
					<tr>
						<td>标题(<span class="required">*</span>)</td>
						<td><input type="text" name="title" value="<{$listinfo.title}>" /></td>
					</tr>
					<tr>
						<td>链接(<span class="required">*</span>)</td>
						<td>
							<{if $product}>
							链接到产品：
							<select id="product_link">
								<option value="0">请选择</option>
								<{foreach from=$product item=p}>
									<option value="<{$smarty.const.__URL__}>product.php?id=<{$p.id}>"><{$p.name}></option>
								<{/foreach}>
							</select>
							&nbsp;&nbsp; 或 &nbsp;&nbsp;自定义链接：
							<{/if}>
							<input type="text" id="custom_link" value="<{$listinfo.link}>" >
							<input type="hidden" name="link" id="link" value="<{$listinfo.link}>" />
						</td>
					</tr>
					<tr>
						<td>显示顺序</td>
						<td><input type="text" name="order" value="<{$listinfo.order|default:'1'}>" ></td>
					</tr>
					<tr>
						<td>内容(<span class="required">*</span>)</td>
						<td><textarea id="ct" name="content"><{$listinfo.content}></textarea></td>
					</tr>
					
				</table>
				<p>
					<input type="submit" value="提交" name="submit">
					<input type="hidden" name="do" value="<{$do|default:'addIndexList'}>">
					<{if $listinfo.id}>
						<input type="hidden" name="id" value="<{$listinfo.id}>" />
					<{/if}>	
				</p>
			</form>
		</div>
	</div>
	<script type="text/javascript" src="<{$smarty.const.__URL__}>plugins/ueditor/editor_config.js"></script>
	<script type="text/javascript" src="<{$smarty.const.__URL__}>plugins/ueditor/editor_all_min.js"></script>	
	<script type="text/javascript">
		var editor = new baidu.editor.ui.Editor();
		editor.render("ct");
		$(document).ready(function(){
			$("#product_link").change(function(){
				var link = $(this).val();
				if( link!=0 ){
					$("#custom_link").val("");
					$("#link").val(link);
				}
			})
			$("#custom_link").blur(function(){
				var link = $(this).val();
				if( link!=0 ){
					$("#product_link").val(0);
					$("#link").val(link);
				}
			})
		})
	</script>
</body>
</html>